package com.lizhenhua.stockquery.service.impl;

import com.lizhenhua.fmmall.entity.ShoppingCartVo;
import com.lizhenhua.stockquery.mapper.StockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class QueryStockServiceImpl implements QueryStock {
    @Autowired
    private StockMapper stockMapper;

    @Override
    public List<ShoppingCartVo> selectShopcartsByCids(String cids) {
        String[] strings = cids.split(",");

        List<Integer> cidsList = new ArrayList<>();

        for (String s : strings
        ) {
            cidsList.add(Integer.parseInt(s));
        }

        List<ShoppingCartVo> productVos = stockMapper.selectShopcartsByCids(cidsList);

        return productVos;
    }


}
